use proc_macro::TokenStream;
use quote::quote;
use syn;

#[proc_macro_derive(LogMacro)]
pub fn log_macro_derive(input: TokenStream) -> TokenStream {
    let ast = syn::parse(input).unwrap();

    impl_log_macro(&ast)
}

fn impl_log_macro(ast: &syn::DeriveInput) -> TokenStream {
    let name = &ast.ident;

    // dbg!(ast);
    let gen = quote! {
        impl LogMacro for #name{
            fn log_macro(){
                println!("hello, Macro! target is {}",stringify!(#name));
            }
        }
    };

    gen.into()
}
